package com.mcxx.modules.minimumliving.controller;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.mcxx.constant.MQConstant;
import com.mcxx.modules.minimumliving.service.QueryService;
import com.mcxx.modules.minimumliving.service.SalvationApplyService;
import com.mcxx.modules.miniSalvation.family.dto.*;
import com.mcxx.modules.miniSalvation.family.entity.*;
import com.mcxx.modules.miniSalvation.family.service.read.*;
import com.mcxx.modules.miniSalvation.family.service.write.BankWriteService;
import com.mcxx.modules.miniSalvation.family.service.write.FamilyMemberWriteService;
import com.mcxx.modules.miniSalvation.family.service.write.FamilySupportWriteService;
import com.mcxx.modules.miniSalvation.family.service.write.SpecialPeopleWriteService;
import com.mcxx.modules.miniSalvation.order.service.read.OrderReadService;
import com.mcxx.modules.miniSalvation.special.entity.SpecialSignEntity;
import com.mcxx.modules.miniSalvation.special.service.read.SpecialSignReadService;
import com.mcxx.modules.system.dto.DataSyncMessage;
import com.mcxx.modules.system.dto.MQMessageDTO;
import com.mcxx.result.BaseResult;
import com.mcxx.service.DefaultRestService;
import com.mcxx.util.Constant;
import com.mcxx.validate.group.Creation;
import com.mcxx.validate.group.Update;
import com.yinhai.ta404.core.restservice.annotation.RestService;
import com.yinhai.ta404.core.utils.UUIDUtils;
import com.yinhai.ta404.core.validate.annotation.V;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;


@Validated
@Api("低保申请控制类")
@RestService({"minimumliving/salvation/request/v2"})
public class SalvationRequestController extends DefaultRestService {

    private static final Logger logger = LoggerFactory.getLogger(SalvationRequestController.class);

    @Autowired
    private SalvationApplyService salvationApplyService;
    @Autowired
    private FamilySupportWriteService familySupportWriteService;
    @Autowired
    private FamilySupportReadService familySupportReadService;
    @Autowired
    private MemberAssetsReadService memberAssetsReadService;
    @Autowired
    private SpecialPeopleWriteService specialPeopleWriteService;
    @Autowired
    private SpecialPeopleReadService specialPeopleReadService;
    @Autowired
    private FamilyMemberReadService familyMemberReadService;
    @Autowired
    private FamilyMemberWriteService familyMemberWriteService;
    @Autowired
    private OrderReadService orderReadService;
    @Autowired
    private RabbitTemplate rabbitTemplate;
    @Autowired
    private QueryService queryService;
    @Autowired
    private FamilyMainReadService familyMainReadService;
    @Autowired
    private BankReadService bankReadService;
    @Autowired
    private BankWriteService bankWriteService;
    @Autowired
    private SpecialSignReadService specialSignReadService;

    
    @PostMapping("saveSalvationRequest")
    @ApiOperation("保存申请信息")
    public void saveSalvationRequest(@Validated(Creation.class)MininumLivingApplyDTO applyDto) {
        logger.info("开始保存申请信息，参数是：{}", applyDto);
        ApplyRtnDTO applyRtnDTO = salvationApplyService.addSalvationRequest(applyDto, getCurUserAccount());
        setData(applyRtnDTO);
        logger.info("保存申请信息结束，结果是：{}", JSON.toJSONString(applyDto));
    }

    
    @PostMapping("modifySalvationRequest")
    @ApiOperation("更新申请信息")
    public void modifySalvationRequest(@Validated(Update.class) MininumLivingApplyDTO applyDto) {
        logger.info("开始更新申请信息，参数是：{}", applyDto);
        ApplyRtnDTO applyRtnDTO = salvationApplyService.modifySalvationRequest(applyDto, getCurUserAccount(),null);
        setData(applyRtnDTO);
        logger.info("更新申请信息结束，结果是：{}", JSON.toJSONString(applyDto));
    }

    
    @PostMapping("houseHoldCancelSave")
    @ApiOperation("整户停保保存")
    public void houseHoldCancelSave(@Validated(Update.class) MininumLivingApplyDTO applyDto) {
        logger.info("开始更新申请信息，参数是：{}", applyDto);
        ApplyRtnDTO applyRtnDTO = salvationApplyService.houseHoldCancelSave(applyDto, getCurUserAccount());
        setData(applyRtnDTO);
        logger.info("更新申请信息结束，结果是：{}", JSON.toJSONString(applyDto));
    }

    
    @PostMapping("tempSaveInHouse")
    @ApiOperation("暂存入户调查")
    public void tempSaveInHouse(MininumLivingApplyDTO applyDto){
        logger.info("暂存入户调查，参数是：{}", applyDto);
        ApplyRtnDTO applyRtnDTO = salvationApplyService.tempSaveInHouse(applyDto, getCurUserAccount(),null);
        setData(applyRtnDTO);
        logger.info("暂存入户调查，结果是：{}", JSON.toJSONString(applyDto));
    }

    
    @PostMapping("completeInHouse")
    @ApiOperation("结束入户调查")
    public void completeInHouse(MininumLivingApplyDTO applyDto){
        logger.info("结束入户调查，参数是：{}", applyDto);
        ApplyRtnDTO applyRtnDTO = salvationApplyService.completeInHouse(applyDto, getCurUserAccount(),null);
        setData(applyRtnDTO);
        logger.info("结束入户调查，结果是：{}", JSON.toJSONString(applyDto));
    }

    
    @PostMapping("canUpdateSalvationInfo")
    @ApiOperation("能否更新申请信息")
    public void canUpdateSalvationInfo(@V({"notnull"})String orderId){
          logger.info("能否更新申请信息，参数是：{}",orderId);
          orderReadService.isCalSalary(orderId);
          logger.info("能否更新申请信息，结果{}", true);
    }

    
    @GetMapping("getOrderDetailById")
    @ApiOperation("查询申请信息")
    public void getOrderDetailById(@V({"notnull"}) String orderId) {
        logger.info("开始查询申请信息，参数是：{}", orderId);
        MininumLivingApplyDTO applyDto = orderReadService.getDetailById(orderId);
        setData(applyDto);
        logger.info("查询申请信息结束，参数是：{}", applyDto);
    }


    

    
    @GetMapping("getFamilyMemberList")
    @ApiOperation("根据familyId查询状态正常的家庭成员列表")
    public void getFamilyMemberList(@V({"notnull"}) String familyId) {
        logger.info("开始查询状态正常的家庭成员列表，参数是：{}", familyId);
        List<FamilyMemberEntity> memberList = familyMemberReadService.listNormalMemberByFamilyId(familyId);
        setData(memberList);
        logger.info("开始查询状态正常的家庭成员列表，参数是：{}", memberList);
    }

    
    @GetMapping("changeMemberIsApply")
    @ApiOperation("更新家庭成员的是否申请人")
    public void changeMemberIsApply(@V({"notnull"}) String familyId,@V({"notnull"}) String memberId) {
        logger.info("开始更新家庭成员的是否申请人，参数是：{}", familyId);
        int i = familyMemberWriteService.changApplyMember(familyId,memberId);
        setData(i);
        logger.info("开始更新家庭成员的是否申请人，参数是：{}", i);
    }

    
    @GetMapping("getFamilyMemberListForMoveOut")
    @ApiOperation("根据familyId查询状态正常的家庭成员列表")
    public void getFamilyMemberListForMoveOut(@V({"notnull"}) String memberId) {
        logger.info("开始查询状态正常的家庭成员列表，参数是：{}", memberId);
        FamilyMemberDTO familyMemberEntity = familyMemberReadService.getFamilyMemberListForMoveOut(memberId);
        setData(new ArrayList<FamilyMemberDTO>(){{add(familyMemberEntity);}});
        logger.info("开始查询状态正常的家庭成员列表，参数是：{}", familyMemberEntity);
    }

    
    @GetMapping("getFamilyMemberById")
    @ApiOperation("根据id查询指定家庭成员信息")
    public void getFamilyMemberById(@V({"notnull"}) String id) {
        FamilyMemberEntity memberEntity = familyMemberReadService.getById(id);
        setData(memberEntity);
    }


    
    @GetMapping("getFamilyBankInfoById")
    @ApiOperation("根据familyId查询指定家庭银行卡")
    public void getFamilyBankInfoById(@V({"notnull"}) String familyId,@V({"notnull"}) String memberId) {
        logger.info("根据familyId查询指定家庭银行卡，参数是：{}", familyId);
        BankEntity bankEntity = bankReadService.getBankByFamilyIdEdit(familyId,memberId,Constant.BusinessCode.DIBAO);
        setData(bankEntity);
        logger.info("根据familyId查询指定家庭银行卡结束，参数是：{}", familyId);
    }

    
    @GetMapping("gainBankInfo")
    @ApiOperation("获取财政银行卡信息")
    public void gainBankInfo(@Validated BankAbutmentDTO dto) {
        logger.info("开始获取财政银行卡信息，参数是：{}", dto);
        Map<String, String> map = salvationApplyService.gainBankInfo(dto,getCurUserAccount());
        setData(map);

        logger.info("获取财政银行卡信息结束");
    }

    
    @RequestMapping("addFamilyMember")
    @ApiOperation("添加家庭成员")
    public void addFamilyMember(@Validated FamilyMemberDTO dto) {
        logger.info("开始添加家庭成员信息，参数是：{}", dto);
        dto.setBusinessType(Constant.BusinessCode.DIBAO);
        String id = salvationApplyService.addFamilyMember(dto, getCurUserAccount());
        logger.info("添加家庭成员信息结束");

        String msgId = UUIDUtils.getUUID();
        DataSyncMessage dataSyncMessage = new DataSyncMessage(id,Constant.DataSyncObjectType.PERSON,Constant.DataSyncOperationType.ADD);
        MQMessageDTO<String> messageDTO = new MQMessageDTO(msgId, dataSyncMessage);
        CorrelationData correlationData = new CorrelationData(msgId);
        String message = JSONObject.toJSONString(messageDTO);
        rabbitTemplate.convertAndSend(MQConstant.DataSyncQueue.EXCHANGE, MQConstant.DataSyncQueue.ROUTEKEY, message, correlationData);
    }

    
    @RequestMapping("modifyFamilyMember")
    @ApiOperation("更新家庭成员信息")
    public void modifyFamilyMember(@Validated FamilyMemberDTO dto) {
        logger.info("开始更新家庭成员信息，参数是：{}", dto);
        dto.setBusinessType(Constant.BusinessCode.DIBAO);
        salvationApplyService.updateFamilyMember(dto,getCurUserAccount());
        logger.info("更新家庭成员信息结束");

        String msgId = UUIDUtils.getUUID();
        DataSyncMessage dataSyncMessage = new DataSyncMessage(dto.getId(),Constant.DataSyncObjectType.PERSON,Constant.DataSyncOperationType.UPDATE);
        MQMessageDTO<String> messageDTO = new MQMessageDTO(msgId, dataSyncMessage);
        CorrelationData correlationData = new CorrelationData(msgId);
        String message = JSONObject.toJSONString(messageDTO);
        rabbitTemplate.convertAndSend(MQConstant.DataSyncQueue.EXCHANGE, MQConstant.DataSyncQueue.ROUTEKEY, message, correlationData);
    }

    
    @PostMapping("delFamilyMember")
    @ApiOperation("删除家庭成员信息")
    public void delFamilyMember(FamilyMemberDTO dto) {
        logger.info("开始删除家庭成员信息，参数是：{}", dto);
        salvationApplyService.delete(dto,getCurUserAccount());
        logger.info("删除家庭成员信息结束");
    }

    
    @PostMapping("changeFamilyMaster")
    @ApiOperation("户主变更")
    public void changeFamilyMaster(@V({"notnull"}) String familyId,@V({"notnull"}) String orderId, @V({"notnull"}) @RequestPart Map<String,String> relationMap) {
        logger.info("开始变更户主，参数是：{},{},{}", familyId, orderId, relationMap);
        familyMemberWriteService.changeFamilyRelation(familyId, orderId, relationMap);
        logger.info("开始变更户主结束");
    }

    
    @GetMapping("getFamilyRelationMap")
    @ApiOperation("获取家庭成员关系")
    public void getFamilyRelationMap(@V({"notnull"}) String familyId) {
        logger.info("开始获取家庭成员关系，参数是：{}", familyId);
        List<FamilyMemberEntity> relationMap = familyMemberReadService.getFamilyRelationMap(familyId);
        setData(relationMap);
        logger.info("获取家庭成员关系结束，参数是：{}", relationMap);
    }

    

    

    
    @GetMapping("getFamilySupportList")
    @ApiOperation("获取赡(抚扶)养义务人列表")
    public void getFamilySupportList(@V({"notnull"}) String familyId) {
        logger.info("开始获取赡(抚扶)养义务人列表，参数是：{}", familyId);
        List<FamilySupportEntity> supportList = familySupportReadService.getFamilySupportList(familyId);
        setData(supportList);
        logger.info("获取赡(抚扶)养义务人列表结束，参数是：{}", supportList);
    }

    
    @GetMapping("getFamilySupportById")
    @ApiOperation("查询指定赡养人信息")
    public void getFamilySupportById(@V({"notnull"}) String id){
        logger.info("开始查询指定赡养人信息，参数是：{}", id);
        FamilySupportEntity support = familySupportReadService.getFamilySupportById(id);
        setData(support);
        logger.info("查询指定赡养人信息结束，结果是：{}", support);
    }

    
    @GetMapping("getFamilySupportByIds")
    @ApiOperation("查询指定赡养人信息")
    public void getFamilySupportByIds(@V({"notnull"}) String id,@V({"notnull"}) String orderId){
        logger.info("开始查询指定赡养人信息，参数是：{}", id);
        


        FamilySupportEntity support = queryService.getFamilySupportByIds(id,orderId);
        setData(support);
        logger.info("查询指定赡养人信息结束，结果是：{}", support);
    }
    
    @GetMapping("getMemberByIdAndOrderId")
    @ApiOperation("根据id和orderId查询指定家庭成员信息")
    public void getMemberByIdAndOrderId(@V({"notnull"}) String id, @V({"notnull"}) String orderId) {
        logger.info("根据id和orderId查询指定家庭成员信息，参数：{}", id);
        FamilyMemberDTO familyMemberDTO = queryService.getFamilyMemberBankInfo(id, orderId,Constant.BusinessCode.DIBAO);
        setData(familyMemberDTO);
        logger.info("根据id和orderId查询指定家庭成员信息完成，结果：{}", JSON.toJSONString(familyMemberDTO));
    }

    
    @PostMapping("addFamilySupport")
    @ApiOperation("添加赡(抚扶)养义务人信息")
    public void addCaregiver(@Validated(Creation.class) FamilySupportEntity entity) {
        logger.info("添加赡(抚扶)养义务人信息，参数：{}", JSON.toJSONString(entity));
        familySupportWriteService.addFamilySupport(entity);
        logger.info("添加赡(抚扶)养义务人信息完成");
    }

    
    @PostMapping("modifyFamilySupport")
    @ApiOperation("更新赡(抚扶)养义务人信息")
    public void updateCaregiver(@Validated(Update.class) FamilySupportEntity entity){
        logger.info("更新赡(抚扶)养义务人信息，参数：{}", JSON.toJSONString(entity));
        familySupportWriteService.modifyFamilySupport(entity);
        logger.info("更新赡(抚扶)养义务人信息完成");
    }

    
    @PostMapping("delFamilySupportById")
    @ApiOperation("删除赡(抚扶)养义务人信息")
    public void delFamilySupportById(@V({"notnull"}) String id){
        logger.info("删除指定特殊人员备案信息，参数为id：{}", id);
        familySupportWriteService.delFamilySupportById(id);
        logger.info("删除指定特殊人员备案信息完成");
    }

    
    @PostMapping("verifySupportIdcard")
    @ApiOperation("验证赡(抚扶)养义务人身份证号码在当前家庭唯一存在")
    public void verifySupportIdcard(@V({"notnull"}) String familyId, @V({"notnull"}) String idcard, String supportId){
        logger.info("验证赡(抚扶)养义务人身份证号码在当前家庭唯一存在，参数是：familyId:{},idcard:{}", familyId,idcard);
        familySupportReadService.verifyIdcardInFamily(familyId, idcard, supportId);
        logger.info("验证赡(抚扶)养义务人身份证号码在当前家庭唯一存在，结果是：{}", true);
    }


    
    @PostMapping("getSaveMemberNumber")
    @ApiOperation("获得对应order保障人数")
    public void getSaveMemberNumber(String orderId){
        logger.info("获得对应order保障人数,参数是：{}", orderId);
        int saveMemberNumber = orderReadService.getSaveMemberNumber(orderId);
        setData(saveMemberNumber);
        logger.info("获得对应order保障人数,结果是：{}", saveMemberNumber);
    }

    
    @PostMapping("modifyFamilyHolder")
    @ApiOperation("迁移户主。当申请人状态为嫁娶、分户迁出、狱中服刑时，调用此接口以申请人为户主，新建一个家庭。")
    public void modifyFamilyHolder(String familyId,@V({"notnull"}) String idcard){
        logger.info("迁移户主，参数为familyId：{}，idcard：{}", familyId,idcard);
        String newFamilyId = salvationApplyService.modifyFamilyHolder(familyId,idcard,getCurUserAccount());
        setData(newFamilyId);
        logger.info("迁移户主完成，结果为newFamilyId：{}",newFamilyId);
    }

    

    

    
    @GetMapping("getFamilySpecialList")
    @ApiOperation("获取特殊人员备案信息列表")
    public void getFamilySpecialList(@V({"notnull"}) String familyId){
        logger.info("获取特殊人员备案信息列表，参数：familyId: {}", familyId);
        List<FamilySpecialEntity> list = specialPeopleReadService.getFamilySpecialList(familyId);
        setData(list);
        logger.info("获取特殊人员备案信息列表完成，结果：{}", JSON.toJSONString(list));
    }
    
    @GetMapping("listFamilySuppor")
    @ApiOperation("获取赡(抚扶)养义务人列表")
    public void listFamilySuppor(@V({"notnull"}) String orderId) {
        logger.info("开始获取赡(抚扶)养义务人列表，参数：{}", orderId);

        List list = queryService.listFamilySuppor(orderId);
        setData(list);
        logger.info("获取赡(抚扶)养义务人列表结束，结果：{}", list);
    }

    
    @GetMapping("listFamilySpecial")
    @ApiOperation("根据orderId查询特殊备案人员列表")
    public void listFamilySpecial(@V({"notnull"}) String orderId){
        logger.info("根据orderId查询特殊备案人员列表，参数：{}", orderId);
        List list = queryService.listFamilySpecial(orderId);
        setData(list);
        logger.info("获取特殊人员备案信息列表完成，结果：{}", JSON.toJSONString(list));
    }

    
    @GetMapping("getFamilySpecial")
    @ApiOperation("查询指定特殊人员备案信息")
    public void getFamilySpecial(@V({"notnull"}) String id){
        logger.info("查询指定特殊人员备案信息，参数：id: {}", id);
        FamilySpecialEntity entity = specialPeopleReadService.getSpecialPeopleById(id);
        setData(entity);
        logger.info("查询指定特殊人员备案信息完成，结果: {}", JSON.toJSONString(entity));
    }

    
    @GetMapping("getFamilySpecialById")
    @ApiOperation("查询指定特殊人员备案信息")
    public void getFamilySpecialById(@V({"notnull"}) String id,@V({"notnull"}) String orderId){
        logger.info("查询指定特殊人员备案信息，参数：id: {}", id);


        FamilySpecialEntity familySpecialEntity = queryService.getFamilySpecialById(id,orderId);
        setData(familySpecialEntity);
        logger.info("查询指定特殊人员备案信息完成，结果: {}", JSON.toJSONString(familySpecialEntity));
    }

    
    @PostMapping("addFamilySpecial")
    @ApiOperation("添加特殊备案人员信息")
    public void addSpecialPeople(@Validated(Creation.class) FamilySpecialEntity entity){
        logger.info("添加特殊备案人员信息，参数：{}", JSON.toJSONString(entity));
        specialPeopleWriteService.addFamilySpecial(entity);
        logger.info("添加特殊备案人员信息完成");
    }

    
    @PostMapping("modifyFamilySpecial")
    @ApiOperation("更新特殊备案人员信息")
    public void modifyFamilySpecial(@Validated(Update.class) FamilySpecialEntity entity){
        logger.info("更新特殊备案人员信息，参数：{}", JSON.toJSONString(entity));
        specialPeopleWriteService.modifyFamilySpecial(entity);
        logger.info("更新特殊备案人员信息");
    }

    
    @PostMapping("delFamilySpecial")
    @ApiOperation("根据id删除指定特殊人员备案信息")
    public void delFamilySpecial(@V({"notnull"}) String id){
        logger.info("删除指定特殊人员备案信息，参数为id：{}", id);
        specialPeopleWriteService.delFamilySpecialById(id);
        logger.info("删除指定特殊人员备案信息完成");
    }
    

    

    
    @PostMapping("queryHandleStatusByIdCardNumber")
    @ApiOperation("按身份证号查询办理情况")
    public void queryHandleStatusByIdCardNumber(@V({"notnull"})  String idcard,@V({"notnull"})  String businessCode) {
        logger.info("按身份证号查询办理情况,参数是:{}", idcard);
        BaseResult<MemberCardRtnDTO> rstData = salvationApplyService.checkCardIdExist(idcard,businessCode,getCurUserAccount());

        setData(rstData);
        logger.info("按身份证号查询办理情况,结果是:{}", rstData);
    }

    
    @PostMapping("familyMemberIdCardCheck")
    @ApiOperation(value="成员的身份证验证", produces = MediaType.APPLICATION_JSON_UTF8_VALUE,notes="成员的身份证验证")
    public void familyMemberIdCardCheck(@V({"notnull"})  String idcard, @V({"notnull"})  String familyId){
        logger.info("成员的身份证验证,参数是:{}", idcard);
        BaseResult<FamilyThreeMemberDTO> rstData = familyMemberReadService.checkIdcardForAddMember(idcard, familyId);
        setData(rstData);
        logger.info("成员的身份证验证,结果是:{}", rstData);
    }

    

    

    
    @GetMapping("getMemberAssetsList")
    @ApiOperation("根据familyId获取员财产收入列表")
    public void getMemberAssetsList(@V({"notnull"}) String familyId, @V({"notnull"}) String orderId) {
        logger.info("根据familyId获取员财产收入列表，参数是：{}", familyId);
        List<MemberAssetsDTO> list = memberAssetsReadService.queryListByFamilyId(familyId, orderId,"");
        setData(list);
        logger.info("根据familyId获取员财产收入列表，结果是：{}", list);
    }

    
    @GetMapping("getMemberAssetsById")
    @ApiOperation("根据id获取员财产收入列表")
    public void getMemberAssetsById(@V({"notnull"}) String id) {
        logger.info("根据id获取员财产收入列表，参数是：{}", id);
        MemberAssetsEntity entity = memberAssetsReadService.getById(id);
        setData(entity);
        logger.info("根据id获取员财产收入列表，结果是：{}", entity);
    }

    
    @PostMapping("addMemberAssets")
    @ApiOperation("新增成员财产收入")
    public void addMemberAssets(@Validated(Creation.class) MemberAssetsEntity memberAssetsEntity){
        logger.info("新增成员财产收入，参数：{}", JSON.toJSONString(memberAssetsEntity));
        double familyRevenue = salvationApplyService.saveMemberAssets(memberAssetsEntity, getCurUserAccount());
        setData(familyRevenue);
        logger.info("新增成员财产收入，家庭人均月收入结果是：{}", familyRevenue);
    }

    
    @PostMapping("modifyMemberAssets")
    @ApiOperation("修改成员财产收入")
    public void modifyMemberAssets(@Validated(Update.class) MemberAssetsEntity memberAssetsEntity){
        logger.info("修改成员财产收入，参数：{}", JSON.toJSONString(memberAssetsEntity));
        double familyRevenue = salvationApplyService.saveMemberAssets(memberAssetsEntity, getCurUserAccount());
        setData(familyRevenue);
        logger.info("修改成员财产收入，家庭人均月收入结果是：{}", familyRevenue);
    }

    
    @PostMapping("delMemberAssets")
    @ApiOperation("删除成员财产收入")
    public void delMemberAssets(@V({"notnull"}) MemberAssetsEntity memberAssetsEntity){
        logger.info("删除成员财产收入，参数：{}", memberAssetsEntity);
        double familyRevenue = salvationApplyService.deleteMemberAssets(memberAssetsEntity);
        setData(familyRevenue);
        logger.info("修改成员财产收入，家庭人均月收入结果是：{}", familyRevenue);
    }
    

    
    @RequestMapping("backUpHtml")
    @ApiOperation("低保信息备份")
    public void backHtml(@V({"notnull"}) String orderId,@V({"notnull"}) String familyId){
         logger.info("低保信息备份开始,参数：{},{}",orderId,familyId);
         String res = salvationApplyService.backupHtml(orderId,familyId,Constant.BusinessCode.DIBAO);
         setData(res);
         logger.info("低保信息备份结束,结果是:{}",res);
    }
    
    @GetMapping("getFamilyApply")
    @ApiOperation("获取家庭成员申请人")
    public void getFamilyApply(@V({"notnull"}) String familyId) {
        logger.info("开始获取家庭成员是否申请人，参数是：{}", familyId);
        List<FamilyMemberEntity> relationMap = familyMemberReadService.getFamilyApplyMapByFamilyId(familyId);
        setData(relationMap);
        logger.info("获取家庭成员是否申请人结束，参数是：{}", relationMap);
    }
    
    @PostMapping("changeMemberApply")
    @ApiOperation("申请人变更")
    public void changeMemberApply(@V({"notnull"}) String familyId,@V({"notnull"}) String orderId, @V({"notnull"}) @RequestPart Map<String,String> relationMap) {
        logger.info("开始变更申请人，参数是：{},{},{}", familyId, orderId, relationMap);
        salvationApplyService.changeMemberApply(familyId, orderId, relationMap,getCurUserAccount());
        logger.info("开始变更申请人结束");
    }
    
    @PostMapping("getApplyByFamilyId")
    @ApiOperation("根据家庭id获取申请人信息")
    public void getApplyByFamilyId(@V({"notnull"}) String familyId) {
        logger.info("根据家庭id获取申请人信息，参数是：{}", familyId);
        FamilyMemberEntity memberEntity = familyMemberReadService.selectApplyByFamilyId(familyId);
        setData(memberEntity);
        logger.info("根据家庭id获取申请人信息结束");
    }
    
    @PostMapping("getFamilyRevenue")
    @ApiOperation("查询家庭月人均收入")
    public void getFamilyRevenue(@V({"notnull"}) String familyId) {
        logger.info("开始变更申请人，参数是：{}", familyId);
        String familyRevenue = familyMainReadService.selectFamilyRevenue(familyId);
        setData(familyRevenue);
        logger.info("开始变更申请人结束");
    }

    
    @PostMapping("getCalculateHtml")
    @ApiOperation("根据id获取员财产收入列表")
    public void getCalculateHtml(@V({"notnull"}) String familyId) {
        logger.info("根据familyId查询精准计算页面，参数是：{}", familyId);
        String htmlName = familyMainReadService.selectCalculateHtml(familyId);
        setData(htmlName);
        logger.info("根据familyId查询精准计算页面，结果是：{}", htmlName);
    }
    
    @PostMapping("houseHoldSuspend")
    @ApiOperation("整户停保")
    public void houseHoldSuspend(@V({"notnull"})String orderId,@V({"notnull"}) String familyId) {
        logger.info("对家庭成员进行整户停保，参数是：{},{}", orderId,familyId);
        int i = salvationApplyService.houseHoldSuspend(orderId,familyId);
        logger.info("对家庭成员进行整户停保，结果是：{}", i);
    }

    
    @PostMapping("suspend")
    @ApiOperation("整户暂停")
    public void suspend(@V({"notnull"})String orderId,@V({"notnull"}) String familyId) {
        logger.info("对家庭成员进行整户暂停，参数是：{},{}", orderId,familyId);
        int i = salvationApplyService.suspend(orderId,familyId);
        logger.info("对家庭成员进行整户暂停，结果是：{}", i);
    }
    
    @PostMapping("resetMemberState")
    @ApiOperation("停保人员重置为正常")
    public void resetMemberState(@V({"notnull"}) String familyId) {
        logger.info("根据familyId停保人员重置为正常，参数是：{}", familyId);
        int i = familyMemberWriteService.resetMemberState(familyId);
        logger.info("根据familyId停保人员重置为正常，结果是：{}", i);
    }
    
    @PostMapping("resetBankByFamilyId")
    @ApiOperation("将家庭的银行卡信息置为无效")
    public void stopBankByFamilyId(String familyId,String memberId) {
        logger.info("将家庭的银行卡信息置为无效，参数是：{},{}", familyId,memberId);
        int i = bankWriteService.resetBankAccountByFamilyId(familyId,memberId);
        setData(i);
        logger.info("获取财政银行卡信息结束");
    }

    
    @PostMapping("getPhoneByFamilyId")
    @ApiOperation("查询家庭表中申请人的手机号")
    public void getPhoneByFamilyId(String familyId) {
        logger.info("查询家庭表中申请人的手机号，参数是：{}", familyId);
        String phone =  familyMainReadService.selectPhoneByFamilyId(familyId);
        setData(phone);
        logger.info("查询家庭表中申请人的手机号结束,结果是：{}",phone);
    }
    
    @GetMapping("getSpecialSign")
    @ApiOperation("获取特殊标识数据")
    public void getSpecialSign(){
        logger.info("获取特殊标识数据");
        List<SpecialSignEntity> SpecialSignList = specialSignReadService.getSpecialSign(getCurUserAccount());
        setData(SpecialSignList);
        logger.info("获取特殊标识数据,结果是：{}", SpecialSignList);
    }
    
    @PostMapping("getSpecialSignByIdcard")
    @ApiOperation("根据身份证查询特殊标识")
    public void getSpecialSignByIdcard(String idcard) {
        logger.info("根据身份证查询特殊标识，参数是：{}", idcard);
        String oldSpecialValues =  specialSignReadService.getSpecialSignByIdcard(idcard);
        setData(oldSpecialValues);
        logger.info("根据身份证查询特殊标识,结果是：{}",oldSpecialValues);
    }
}
